﻿using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using WalkingTec.Mvvm.Core;
using System.Text.Json.Serialization;
using nERP.Model;
using nERP.Model.Fin;
using nERP.Model.So;

namespace nERP.Model.Fin
{
    /// <summary>
    /// 收款单明细
    /// </summary>
	[Table("ReceivableDetail")]
    [SoftKey(nameof(ReceivableDetail.ReceivableDetailCode))]
    [Display(Name = "_Model.ReceivableDetail")]
    public class ReceivableDetail : BasePoco, ITenant
    {
        [Display(Name = "_Model._ReceivableDetail._Seq")]
        [Comment("序号")]
        public int? Seq { get; set; }
        [Display(Name = "_Model._ReceivableDetail._ReceivableDetailCode")]
        [StringLength(32, ErrorMessage = "Validate.{0}stringmax{1}")]
        [Comment("收款明细单号")]
        [Required(ErrorMessage = "Validate.{0}required")]
        [CanNotEdit]
        public string ReceivableDetailCode { get; set; }
        [Display(Name = "_Model._ReceivableDetail._Receivable")]
        [Comment("收款单")]
        [NotMapped]
        public Receivable Receivable { get; set; }
        [Display(Name = "_Model._ReceivableDetail._Receivable")]
        [StringLength(32, ErrorMessage = "Validate.{0}stringmax{1}")]
        [Comment("收款单")]
        public string ReceivableId { get; set; }
        [Display(Name = "_Model._ReceivableDetail._Sale")]
        [Comment("销售订单")]
        [NotMapped]
        public Sale Sale { get; set; }
        [Display(Name = "_Model._ReceivableDetail._Sale")]
        [StringLength(32, ErrorMessage = "Validate.{0}stringmax{1}")]
        [Comment("销售订单")]
        public string SaleId { get; set; }
        [Display(Name = "_Model._ReceivableDetail._Amount1")]
        [Comment("单据金额")]
        public decimal? Amount1 { get; set; }
        [Display(Name = "_Model._ReceivableDetail._Amount2")]
        [Comment("已结金额")]
        public decimal? Amount2 { get; set; }
        [Display(Name = "_Model._ReceivableDetail._Amount3")]
        [Comment("未结金额")]
        public decimal? Amount3 { get; set; }
        [Display(Name = "_Model._ReceivableDetail._Amount4")]
        [Required(ErrorMessage = "Validate.{0}required")]
        [Comment("本次结算金额")]
        public decimal? Amount4 { get; set; }
        [Display(Name = "_Model._ReceivableDetail._Status")]
        [Comment("状态")]
        public dStatusTypeEnum? Status { get; set; } = dStatusTypeEnum.Unaudited;
        [Display(Name = "_Model._ReceivableDetail._Remark")]
        [StringLength(256, ErrorMessage = "Validate.{0}stringmax{1}")]
        [Comment("备注")]
        public string Remark { get; set; }
        [StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
        public string TenantCode { get; set; }

    }

}
